﻿using System;

namespace Rsdn.SmartApp
{
    /// <summary>
    /// Брокер событий.
    /// </summary>
    public interface IEventBroker
    {
        /// <summary>
        /// Оповестить подписчиков о событии.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="eventName">Name of the event.</param>
        /// <param name="arg">The arg.</param>
        void Fire<T>(string eventName, T arg);

        /// <summary>
        /// Подписаться на событие.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="eventName">Name of the event.</param>
        /// <param name="observer">The observer.</param>
        /// <returns></returns>
        IDisposable Subscribe<T>(string eventName, IObserver<T> observer);
    }
}